package com.example.score.controller;

import org.springframework.security.access.annotation.Secured;
import org.springframework.security.core.context.SecurityContextHolder;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
/**
 * @author shenrui
 * @date 2021/9/26
 * @description 设置各页面跳转
 */
@Controller
public class PageController {
    @RequestMapping({"/admin_login","/"})
    public String admin() {
        //已经登录用户无需登录
        if(!SecurityContextHolder.getContext().getAuthentication().getName().equals("anonymousUser")) {
            return "/admin_main";
        } else {
            return "admin_login";
        }
    }
    @RequestMapping("/admin_main")
    public String adminMain(){

        return "admin_main";
    }

    @Secured("ROLE_super")
    @RequestMapping("/super_admin_list")
    public String superAdminList(){

        return "super_admin_list";
    }

    @Secured("ROLE_super")
    @RequestMapping("/super_admin_add")
    public String superAdminAdd(){

        return "super_admin_add";
    }

    @RequestMapping("/admin_stu_list")
    public String studentManage(){

        return "admin_stu_list";
    }

    @RequestMapping("/admin_teacher_list")
    public String teacherManage(){

        return "admin_teacher_list";
    }

    @RequestMapping("/class_list")
    public String classManage(){

        return "class_list";
    }

    @RequestMapping("/class_detail")
    public String classDetail(){

        return "class_detail";
    }

    @RequestMapping("/score_list")
    public String scoreList(){

        return "score_list";
    }
    @RequestMapping("/revise_stu_info")
    public String studentInfoJump(){

        return "revise_stu_info";
    }

    @RequestMapping("/revise_stu_password")
    public String studentPasswordJump(){

        return "revise_stu_password";
    }

    @RequestMapping("/super_admin_password")
    public String adminInfoJump(){

        return "super_admin_password";
    }

    @RequestMapping("/course_list")
    public String courseList(){

        return "course_list";
    }
    @RequestMapping("/course_revise")
    public String courseRevice(){

        return "course_revise";
    }
    @RequestMapping("/admin_stu_add")
    public String adminStuAdd(){

        return "admin_stu_add";
    }
    @RequestMapping("/admin_course_add")
    public String adminCourseAdd(){

        return "admin_course_add";
    }
    @RequestMapping("/revise_teacher_password")
    public String teacherPasswordJump(){

        return "revise_teacher_password";
    }

    @RequestMapping("/revise_teacher_info")
    public String teacherInfoJump(){

        return "revise_teacher_info";
    }

    @RequestMapping("/admin_teacher_add")
    public String adminTeacherAdd(){

        return "admin_teacher_add";
    }
}
